class Application
{
  int __selected__;
  int __hover__;
  
  Tab[] tabs;
  String[] sztabs = {"Scatter","Site Comparision","Map","TagClouds"};
    
  Application()
  {
    tabs = new Tab[sztabs.length];
    
    for(int i = 0; i < sztabs.length; i++)
    {
      tabs[i]  = new Tab(i, sztabs[i], 10+150*i, 50, 150, 20);
    }
  }
  
  void draw()
  {
    noStroke();
    
    fill(0);
    rect(0,0,APP_WIDTH, 80);
    for(int i = 0; i < sztabs.length; i++)
    {
      tabs[i].setColor(0xFF333333); 
      
      if(i == __selected__)
        //tabs[i].setColor(0xFFFFFF44);
        tabs[i].setColor(255);
      if(i == __hover__)
        tabs[i].setColor(0x0000FF);
      
      tabs[i].draw();    
    }
    
    fill(0xFF222222);
    rect(0, 70, APP_WIDTH, 10);
  }
  
  void mouseOver()
  {
    __hover__ = -1;
    for(int i = 0; i < sztabs.length; i++)
    {
      if(tabs[i].PointerInBounds(mouseX,mouseY))
      {
        __hover__ = tabs[i].id;
        continue;
      }
    }
  }
  
  void mouseClicked()
  {
    if(__hover__ != -1)
      __selected__ = __hover__;
  }
}


